﻿ {extends file="profile/layout.tpl"}
 {block name="title"}##NA_RESEARCH##{/block}
 {block name="script"}
  $(document).ready(function () {
	 
	 $('table#researches td a.delete').click(function()
    {
        if (confirm("Are you sure you want to delete this row?"))
        {
            var id = $(this).parent().parent().attr('id');
            var data = 'id=' + id ;
            var url = '4_2.php?'+data+'&action=delete';
			window.location.href = url;
        }
    });
	
	$("#frm4_2").validate({
            rules: {
                product_name: {
                    required: true
                },
				author: {
                    required: true
                },
				publisher: {
                    required: true
                },
				issn: {
                    required: true
                }
            },
            messages: {

                product_name: {
                    required: '##EM_PRODUCTNAME_IS_REQUIRED##'
                },
				author: {
                    required: '##EM_AUTHORS_IS_REQUIRED##'
                },
				publisher: {
                    required: '##EM_PUBLISHER_IS_REQUIRED##'
                },
				issn: {
                    required: '##EM_ISSN_IS_REQUIRED##'
                }
            }
			});
  });
{/block}
 
{block name="name"}
    3.##NG_RESEARCH_RESULT##
{/block}
{block name="content"}
   

    <div class="message {$type_message|default:'error'}" style="display:{$is_display|default:'none'};">{$message|default:''}</div>
    <div class="clear">
        </div>	
 
	
    <div class="box round first center">
        <table class="data display datatable" name="researches" id="researches">
            <thead>
                <tr>
                    <td bgcolor="#FFFFFF"><div align="center"><strong>
                         #
                    </strong></div></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_PRODUCT_NAME##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_AUTHORS##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_PUBLISHER##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_ISSN##
                    </strong></td>
					<td bgcolor="#FFFFFF"><strong>
                        ##NG_UPLOAD_EVIDENCE##
                    </strong></td>
					<td bgcolor="#FFFFFF"><strong>
                        ##NG_NOTE##
                    </strong></td>
                    <td bgcolor="#FFFFFF" align="center"></td>
                    <td bgcolor="#FFFFFF" align="center"></td>
                </tr>
            </thead>
            
            <tbody>
            {foreach $research_results|default:array() as $i}
                        
                {if $i@index is div by 2}
                    <tr class="even" id="{$i.Ma}">
                {else}
                    <tr class="odd" id="{$i.Ma}">
                {/if}
                    <td><div align="center">
                            {$i@index + 1}
                    </div></td>
                    <td>
                        {$i.TenSanPham}
                    </td>
                    <td>
                        {$i.TenTacGia}
                    </td>
                    <td>
                        {$i.TenTapChi}
                    </td>
                    <td>
                        {$i.ISSN}
                    </td>
					<td>
                       <a href="download.php?url={$i.MinhChung}">{$i.MinhChung}</a>
                    </td>
					<td>
                        {$i.GhiChu}
                    </td>
                    <td align="center"><a href="4_2.php?id={$i.Ma}&action=edit">##NG_EDIT##</a></td>
                    <td align="center"><a href="" class="delete">##NG_DELETE##</a></td>
                </tr>            
                    
               
            {/foreach}
				
            </tbody> 
        </table>
	</div>
	<div class="clear">
        </div>
	

    <div class="box round first center">
        <h2>##NG_ADDITION_RESEARCH_INFO##</h2>
    <form id="frm4_2" name="frm4_2" action="4_2.php" method="post" enctype="multipart/form-data">
 
    <table class="data display datatable" cellpadding="10" cellspacing="10" 
        align="left" border="2">
        <tbody>
			<tr>
				<td style="vertical-align:middle"><strong>##NG_PRODUCT_NAME##</strong></td>
				<td>
						<input type="hidden" name="id" id="id" value="{$id}"/>
						<textarea rows="4" cols="50" id="product_name" name="product_name" value="">{$product_name|default:''}</textarea>(*)
				</td>
			</tr>
			
			<tr>
                <td><strong>##NG_AUTHORS##:</strong></td>
				<td>
                    <input id="author" type="text" value="{$author|default:''}" maxlength="100" size="50" name="author"/>(*)
                </td>
            </tr>
			
			<tr>
                <td><strong>##NG_PUBLISHER##:</strong></td>
				<td>
                    <input id="publisher" type="text" value="{$publisher|default:''}" maxlength="100" size="50" name="publisher"/>(*)
                </td>
            </tr>
			<tr>
				<td><strong>##NG_RESEARCH_TYPE##:</strong></td>
				<td>
					<select id="research_type" name="research_type">
						{foreach $research_type_array as $i}
							<option value="{$i.Ma}" {if $i.Ma == $research_type|default:'1'}selected{/if}>{$i.LoaiKetQuaNghienCuu}</option>
						{/foreach}
					</select>
				</td>
			</tr>
			
			<tr>
                <td><strong>##NG_ISSN##:</strong></td>
				<td>
                    <input id="issn" type="text" value="{$issn|default:''}" maxlength="100" size="50" name="issn"/>(*)
                </td>
            </tr>
			<tr>
                <td style="vertical-align:middle"><strong>##NG_UPLOAD_EVIDENCE##:</strong></td>
                <td>
                      {if isset($evidence_uploaded)}
					
					<a href="download.php?url={$evidence_uploaded}">{$evidence_uploaded}</a><br>
					{/if}
					<input id="evidence_upload" type="file" maxlength="255" size="40" name="evidence_upload"/>
                </td>
            </tr>
			 <tr>
				<td style="vertical-align:middle"><strong>##NG_MORE_INFO##:</strong></td>
				<td>
					<textarea rows="4" cols="50" id="note" name="note" value="">{$note|default:''}</textarea>
				</td>
			</tr>
            <tr>
                <td colspan="2">
                    <div style="float:left; height:auto">
                        <input type="submit" value="##NG_SAVE##" name="save" class="btn btn-blue"/>
                    </div>
                    <div style="float:right; height:auto">
                        <input type="button" value="##NG_NEXT##" name="next" onclick="window.location.href='4.php'" class="btn btn-blue" />
                    </div>
                </td>
            </tr>

        </tbody>
    </table>
    </form>
    </div>
    <div class="clear">
        </div>
{/block}
